<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<title>修改角色</title>
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<link rel="stylesheet" href="../../css/oksub.css">
	<script type="text/javascript" src="../../lib/loading/okLoading.js"></script>
</head>
<body>
<div class="ok-body">
	<!--form表单-->
	<!--<form class="layui-form layui-form-pane ok-form">-->
	<form class="layui-form ok-form" lay-filter="sysrole-edit">
		<input type="hidden" value="" id="roleId" name="roleId" lay-verify="required">
		<div class="layui-form-item">
			<label class="layui-form-label">角色名称</label>
			<div class="layui-input-block">
				<input type="text" name="roleName" placeholder="角色中文名称" autocomplete="off" class="layui-input" lay-verify="required" lay-verType="tips" id="roleName">
			</div>
		</div>

		<div class="layui-form-item">
			<label class="layui-form-label">角色别名</label>
			<div class="layui-input-block">
				<input type="text" placeholder="角色英文简称" autocomplete="off" class="layui-input" lay-verify="required|roleCode" lay-verType="tips" id="roleCode" disabled>
			</div>
		</div>

		<div class="layui-form-item">
			<label class="layui-form-label">备注</label>
			<div class="layui-input-block">
				<input type="text" name="remark" placeholder="用户什么也没有留下" autocomplete="off" class="layui-input">
			</div>
		</div>

		<div class="layui-form-item">
			<div class="layui-input-block">
				<button class="layui-btn" lay-submit lay-filter="edit">立即提交</button>
				<button type="reset" class="layui-btn layui-btn-primary">重置</button>
			</div>
		</div>
	</form>
</div>
<!--js逻辑-->
<script src="../../lib/layui/layui.js"></script>
<script src="../../libme/pages/body.js"></script>
<script type="text/javascript">
	layui.use(["element", "form", "tree", "okLayer", "okUtils", "jquery","okMock","api"], function () {
		let form = layui.form;
		let okLayer = layui.okLayer;
        let okMock = layui.okMock;
        let $ = layui.jquery;
        let api = layui.api;
		okLoading.close();

		// tree.render({
        // 	elem: "#permissionTree",
        // 	//data: okMock.api.permission.list,
        // 	data: data,//从本地 localStorage 中取值
        // 	showCheckbox: true
        // });

        form.on("submit(edit)", function (data) {
			// TODO 权限节点校验
			api.request({
				url:okMock.api.role.update,
				where: data.field,
				dataType: api.jsonType.ujson
			},function (resp, stat) {
                api.greenTickMsg("添加成功", function () {
                    parent.layer.close(parent.layer.getFrameIndex(window.name));
                });
            })
			return false;
		});

        //页面加载
        $(function () {});
	})
</script>
</body>
</html>
